libxl: a domain can be dying but not shutdown
authorDavid Scott <dave.scott@citrix.com>
Wed, 22 Oct 2014 13:52:41 +0000 (14:52 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 4 Nov 2014 10:25:40 +0000 (10:25 +0000)
The shutdown code is only present if the domain is shutdown.
If we attempt to extract it from the flags from a dying but not
shutdown domain then we get values like '255' which is not a
valid LIBXL_SHUTDOWN_REASON_. We should use LIBXL_SHUTDOWN_UNKNOWN
in this case.

Signed-off-by: David Scott <dave.scott@citrix.com>
Acked-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- updated comment in libxl_types.idl to match ]

tools/libxl/libxl.c
tools/libxl/libxl_types.idl

index 18561fbe595d153a6a5a1755ee22262c78820677..7e7d1dff8fcdbdedffe03ea4fac52f69450d6097 100644 (file)
@@ -609,7 +609,7 @@ static void xcinfo2xlinfo(libxl_ctx *ctx,
     xlinfo->blocked  = !!(xcinfo->flags&XEN_DOMINF_blocked);
     xlinfo->running  = !!(xcinfo->flags&XEN_DOMINF_running);
 
-    if (xlinfo->shutdown || xlinfo->dying)
+    if (xlinfo->shutdown)
         xlinfo->shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
     else
         xlinfo->shutdown_reason = LIBXL_SHUTDOWN_REASON_UNKNOWN;
index ca3f72479dbec2e24a2cb22df361a77f40337b4c..f7fc6957e9f7c2ee57b2aa96ac8172d9b0af0ce3 100644 (file)
@@ -260,7 +260,7 @@ libxl_dominfo = Struct("dominfo",[
     ("shutdown",    bool),
     ("dying",       bool),
 
-    # Valid iff (shutdown||dying).
+    # Valid iff ->shutdown is true.
     #
     # Otherwise set to a value guaranteed not to clash with any valid
     # LIBXL_SHUTDOWN_REASON_* constant.